openarenafandomcom-20200216-history
Mapping manual/Bot play
While a compiled map (.bsp file) allows human players to play, an additional element is necessary, to be able to add bots to the map: an .aas file. Bots try to mimic human players, but they have limitations mappers should consider. Reasons to care for botplay There are many reasons to care for bot play. First, you may make your map so humans can play, but it's very unlikely for your map to end in every real server map rotation, as servers have the tendency to restrict the allowed gametypes and maps to very few of each; this is something called Complacent Gaming Syndrome. And even if your map gets included into official OA releases or popular mappacks, good botplay is also mandatory there: consider players waiting for some other human to join the server: they may play with bots in the meanwhile. Also, not even OA official maps are safe from the above. Plus, a map with bot support enables offline play, so players can play the map even if they can't online. Also, getting rid of the current AI system or changing it with a different system such as waypoints falls outside of the scope of OpenArena, as each map should always have its own AAS file for compatibility reasons. All in all, there's no reason for your maps to lack bot support. BSPC Now let's take a look at what BSPC is, how it works and where to get it. Taken from the BSPC readmeBSPC readme, the BSPC tool is used to create the AAS (Area Awareness System) files from BSP files. The process of AAS file creation is basically the same as the process used by the VIS stage: the map is subdivided in many small nodes called "areas" instead of "leaf nodes", and every area is a visibility section from where other areas can be seen. Areas are then regroupped into bigger zones called Clusters. There are a few differences, though: the only brushes taken in account for the calculation of the areas are the solid, clip, liquid, clusterportal and donotenter ones. This means that structural, detail, patches and areaportals will be taken in account, but hints are not. Clip brushes include clip, botclip, weaponclip and full_clip. Clipping is important for BSPC, as it allows the simplification of the map without modifying the world's geometry. Likewise, clusterportals act as areaportals in the regard that a bot may see an area or not. The latest "official" version of BSPC (created by Mr. Elusive, the creator of the AAS system) is 2.1. BSPC comes bundled with many editors, mainly GTKRadiant, but for editors such as NetRadiant or older versions of *Radiant, however, a newer BSPC must be taken from somewhere else. * BSPC 2.1i (Special version of BSPC created for SimonOC's Pyramid of the Magician) * BSPC @ bnoordhuis' GIT * BSPC @ ttimo' GIT Basic optimizations Taken from Cardigan's bot optimization tutorialBot Optimization Guide by Cardigan, this is a simple list on how to improve bot navigating all over the map. * The first and most basic optimization is to clip your map. Clipping helps a lot to the compilation of AAS file, by making bot navigation around the map a lot easier without the need to change the world's geometry. Use brushes texturized in all of their faces with the texture common/weapclip, common/clip or common/botclip to specify collisions around geometry. ** Weapclip (weapon clip) means that weaponfire, players and bots won't be able to pass through it. ** Clip (player clip) means that players and bots won't pass through it, but weaponfire will do. ** Botclip (bot clip) means that only bots will not be able to pass through it. Botclip can be used to clip walls with uncommon shapes or things incrusted in them. * As botclip blocks the bot from accessing a determined area, in deathpits and other hazard zones like lava/slime pits, use common/botdonotenter instead. botdonotenter acts as a "hint" to not enter a certain area, opposite to botclip which "forbides" them to go to a certain area. ** Also place at the end of the hazardzone a brush texturized in all its faces with the common/nodrop brush. This makes items and flags to disappear at the zone in question. Otherwise, bots would ignore botdonotenter and try to get these items/flags by entering in the hazard/death zone. * If you see that bots aren't going to a certain area, try placing an item_botroam in the problematic area. Don't forget to set its weight value. ** A similar entity is info_camp, which instead allows to suggest bots places adapt for camping. Bots may have more or less "campy" attitude: sometimes they may stop in a certain place and look around, waiting for other players to enter their visual field. Clusterportals If your map is big enough (for instance, lots of levels and Z-axis action) or if it has a lot of complex geometry, try using brushes with common/clusterportal in all of their faces to split the map into different "clusters". Optimization through these invisible and non-solid brushes may allow to prevent bot-related hitches (bot stutter). Some considerations to bear in mind: * Clusterportals MUST seal completely the sections these divide. * You have to be careful with teleporters: sections won't be sealed if there's a teleporter going from one cluster to another, resulting in both clusters merged as one, no matter if the teleport is a one-way one. A solution can be isolating the teleporter (or its surrounding area) from the rest of the map with botclip and placing clusterportal entrances. * Clusterportals won't work if a trigger_push trajectory is crossing it. * Clusterportals MUST be walked to get pass on them, they won't work if the only way to get through it is by falling, it doesn't matter if the clusters get divided succesfully. In other words, you can use clusterportal to seal vertical doors, but not horizontal hatches. * Clusterportals' entrances and exits should be identically shaped. * Clusterportals should be as axial as possible. If you're going to place a clusterportal in an arched door, botclip it to make a rectangular passing, and fill that hole with a clusterportal. * Clusterportals should be surrounded by solid geometry or clip. (No matter if it's a normal clip, botclip or weapclip) * Clusterportals MUST be 16px thick. * Clusterportals should only separate 2 clusters. As a rule of thumb, it's better to try to keep every cluster under 500 areas.Clusters with too many areas may sometimes cause the game to require too much time to determine where a certain bot will go next, hence causing a short "freeze": splitting that huge cluster into smaller clusters should fix the problem. Also, careful clipping usage may allow to get fewer areas. While in-game, /bot_testclusters 1 tells you the number of the cluster you are inYou can compare it with the output of bspc command -in bspc.log- to find out which are the clusters with too many areas, and that may need to be further divided.. /Bot_testclusters works only if the map has got its .aas file, and does not work while spectating. Space maps This is a very touchy issue, so it deserves its own section. In a large space map with lots of jump-pads, placing clusterportals can be a very daunting task, as most of the map is crossed with trigger_push trajectories and teleporters, there are no obvious door-type structures which seal off any area, and there are usually vertical access points to almost every single part of the map. If the map is simple enough, you can get away with not adding clusterportals. But the problem arises with more complex architecture. The only way to get clusterportals working properly in space is to split the map into approximately equal sized sections using huge botclip walls, 16 units thick, which go all the way across the skybox and seal completely the areas they divide. Then, use the clipper tool to make rectangular 'windows' in these walls where the bots will need to go through them, and filling these windows with clusterportals. Like said above, you should be aware of trigger_push trajectories, and surround teleporters with botclip brushes and clusterportal entrances in order to avoid any kind of inconveniences. Considerations * There's no need to use a clusterportal if there's an areaportal on it. * Bots won't go to areas where special tricks such as strafe jumps are required, however sometimes they may perform rocketjumps, if the height is not excessiveBot navigation files: how high bots would jump, and much more.. You may wish to botclip or botdonotenter such areas. * Use "suspended" flag on items with caution, and avoid using it with objective itemsWith gametype objectives, it's advisable to perfectly align their "origin" point with the ground.: bots will try to get "suspended" items only if they can be reached by using an accelerator pad/bounce pad; they will not jump down from a platform to reach a suspended item. * Clip brushes are very useful to make geometry simpler, helping humans and mostly bots to navigate the map. However consider that they are invisible walls on which characters may jump on top and then apparently walking mid-air. * If you compile your map with BSP -meta switch (something nowadays recommended), it's a MUST to use BSPC -forcesidesvisible switch in your map. Otherwise, your bots won't go anywhere, but see everything as solid space. ** Related to the above, everytime the BSP is recompiled, the AAS file must be recompiled as well, or else bot paths are lost. In case only entities were modified, it's possible to only recalculate reachabilties by using bspc -reach mymap.bsp, to save a little time; in every other case, a full AAS re-compiling is required. ** Don't forget the '-optimize' BSPC switch, to compact AAS filesize. It's a very quick option.If an AAS file has not already been optimized, it's possible to use "-aasopt" mode to optimize it later... however, there is no reason for not optimizing at creation time. ** BSPC tool can take advantage of multithreading for faster AAS compiling, but you have to manually set the number of threads ('-threads ' parameter). Please read Multithreaded map compiling for more infos. * Bots do not use light informations: they can locate their target also in a pitch-black room. * Be extremely careful with using the "gametype" key in the func_static entities or any brush-based entity: they cannot be used to make real changes in map flow. AAS file is the same for all gametypes: bot minds do consider func_static brushes as existing even in gametypes where they do not appear, with potential big problems.If you seal a corridor for a certain gametype, bots will never try to pass through that corridor also in all other gametypes; if you set a bridge, a box or a ledge for certain gametypes only, bots may try to step over it also when it does not appear, goofy falling down repeatedly. You can order a team-mate of yours bot to follow you, in team-based modes, to see how it behaves in such places. Usage with nonsolid decorations should be safer. Gametype key is often used with entities. See Mapping#Limiting items to certain gametypes for more infos. * Bot support for offhand grapple, at the moment, is incomplete and buggy. Bots would use it only if bot_grapple variable is set to 1 (enable it for testing purposes only; default value is 0) and the .aas file has been previously compiled specifying the '-grapplereach' BSPC option. You may wish to set that BSPC switch anyway, in case future OA versions may complete bot grapple support; enabling it would cause BSPC tool "reachability" phase to take a bit longer time. Error messages on BSPC Taken from Id's documentation about BSPC: Level designers should not worry too much about the following messages and/or warnings. The things reported are non fatal and won't cause any major problems. Some of the messages are just debug left overs. * AAS_CheckArea: area %d face %d is flipped * AAS_CheckArea: area %d center is %f %f %f * AAS_CheckFaceWindingPlane: face %d winding plane unequal to face plane * AAS_CheckFaceWindingPlane: face %d winding reversed * area %d face %d flipped: front area %d, back area %d * area %d face %d is tiny * face %d and %d, same front and back area but flipped planes * AAS_SplitFace: tiny back face * AAS_SplitFace: tiny back face * AAS_SplitArea: front area without faces * AAS_SplitArea: back area without faces * gsubdiv: area %d has a tiny winding * AAS_TestSplitPlane: tried face plane as splitter * found %d epsilon faces trying to split area %d * AAS_SplitArea: front area without faces * AAS_GetFace: face %d had degenerate edge %d-%d * AAS_GetFace: face %d was tiny * WARNING: huge winding * bogus brush after clip * split removed brush * split not on both sides * two tiny brushes * possible portal: %d * portal %d: area %d * WARNING: CM_GridPlane unresolvable * WARNING: CM_AddFacetBevels... invalid bevel * WARNING: CM_SetBorderInward: mixed plane sides * WARNING: bevel plane already used * trigger_multiple model = "%s" * trigger_teleport model = "%s" * found a trigger_push with velocity %f %f %f * AAS_TraceBoundingBox: stack overflow * AAS_TraceAreas: stack overflow * AAS_LinkEntity: stack overflow * MergeWindings: degenerate edge on winding %f %f %f * Warning: MergeWindings: front to back found twice * FindPlaneSeperatingWindings: winding1 non-convex * FindPlaneSeperatingWindings: winding2 non-convex When one of the following messages, errors or warnings is found then there is often something to be fixed. * WARNING! HashVec: point %f %f %f outside valid range. This should never happen!: While storing the AAS file some vertex was found outside the valid map bounds. When this happens some part of the map is likely to have badly aligned brushes or weird shaped curves. Clipping off or rebuilding complex shapes often helps. * trigger_push start solid: The trigger_push start point is in solid. Try making the trigger_push brush a bit larger or move it around a bit. * trigger_push without target entity %s: Could not find the target entity of the trigger_push with the target field %s. * trigger_push without time: trigger_push entity found without "time" field. * trigger_multiple not in any jump pad area: A trigger_push entity was found not to be in any valid jumppad area. (the message states trigger_multiple but it should have been trigger_push) Try making the trigger_push brush a bit larger or move it around a bit. * trigger_multiple at %1.0f %1.0f %1.0f without target: A trigger multiple was found at the given coordinates without a "target" field. * target_teleporter without target: A target_teleporter entity was found without target field. * trigger_teleport at %1.0f %1.0f %1.0f without target: A trigger_teleport entity was found at the given coordinates without "target" field. * teleporter without misc_teleporter_dest (%s): The destination of a teleporter with target field %s could not be found. * teleporter destination (%s) without origin: A teleporter destination with the target name %s was found without origin field. * teleporter destination (%s) in solid: A teleporter destination with the targetname %s was found to be in solid. * teleported into slime or lava at dest %s: A player would be pushed into slime or lave at the teleporter destination with the targetname %s. * trigger_multiple not in any area: A teleporter trigger was found not to be in any valid area. Try moving the trigger around a bit. * func_plat without model: A func_plat entity was found without model field. * func_plat with invalid model number: A func_plat entity was found with the model field set to some invalid number. * func_bobbing without model: A func_bobbing entity was found without model field. * func_bobbing with invalid model number: A func_bobbing entity was found with the model field set to some invalid number. * %s in solid at (%1.1f %1.1f %1.1f): An item with classname %s was found to be in solid at the given coordinates. * empty aas link heap: Some part of the map has some rather complex clipping. Reduce the geometric complexity or use clip brushes to reduce the clipping complexity. * too many entities in BSP file: There are too many entities in the bsp file. * error opening %s: Could not create a new AAS file. Hard disk might be full. * error writing lump %s: Could not write an AAS lump to file. Hard disk might be full. Notes External links * The Quake III Arena Bot: detailed guide about how the Q3A bots work. Can be useful for bot and map development. * LevelDK 6: clipping and bot play, clusterportals * Cardigan's bot optimization tips * GTKR Manual Bot navigation. Very useful document about BSPC and bot infos such as maximum step height, maximum obstacle/jump height, aas testing. Category:Development Category:Mapping